class Codec:

    def encode(self, strs):
        """Encodes a list of strings to a single string.

        :type strs: List[str]
        :rtype: str
        """
        max_num = 0
        for item in strs:
            left_index = 0
            right_index = 0
            while right_index < len(item):
                if item[right_index] == '#':
                    right_index += 1
                    max_num = max(max_num, right_index - left_index)
                else:
                    left_index = right_index + 1
                    right_index += 1
        encode_str = '#' * (max_num + 1) + '*'
        out = ''
        for item in strs:
            out += encode_str
            out += item
        return out

    def decode(self, s):
        """Decodes a single string to a list of strings.

        :type s: str
        :rtype: List[str]
        """
        num = 0
        for i in range(len(s)):
            if s[i] == '#':
                num += 1
            else:
                break
        split_str = '#' * num + '*'
        return s.split(split_str)[1:]

codec = Codec()
strs = ['###abc', 'def', 'wque']
e = codec.encode(strs)
d = codec.decode(e)
print(d)
